package equals;

public class Phone
{
	String name;
	double price;
	int neicun;
	boolean user;
	public Phone(String name, double price,
			int neicun,boolean user)
	{
		this.name = name;
		this.price = price;
		this.neicun = neicun;
		this.user = user;
	}
	public String toString()
	{
		String restule = "牌子:" + name +  
				";内存:" + neicun + ";use:" + user ;

		return restule;
	}
	public boolean equals(Object obj) 
	{
		if(obj instanceof Phone) 
		{
			Phone p1 = (Phone) obj;
			if(p1.price == this.price )
			{
				if(p1.neicun == this.neicun)
				{
					if(p1.user == this.user)
					{
						if(p1.name.equals(this.name))
						{
							return true;
						}
					}
				}
			}
		}		
		return false;
		
	}
}
